package com.wn.icloud.provider.uac.service.impl;

import com.wn.icloud.provider.uac.entity.EnterpriseHistoryYearInfo;
import com.wn.icloud.provider.uac.mapper.EnterpriseHistoryYearInfoDao;
import com.wn.icloud.provider.uac.service.EnterpriseHistoryYearInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 企业历年指标信息表(EnterpriseHistoryYearInfo)表服务实现类
 *
 * @author makejava
 * @since 2020-04-24 22:23:02
 */
@Service("enterpriseHistoryYearInfoService")
public class EnterpriseHistoryYearInfoServiceImpl implements EnterpriseHistoryYearInfoService {
    @Resource
    private EnterpriseHistoryYearInfoDao enterpriseHistoryYearInfoDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public EnterpriseHistoryYearInfo queryById(String id) {
        return this.enterpriseHistoryYearInfoDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<EnterpriseHistoryYearInfo> queryAllByLimit(int offset, int limit) {
        return this.enterpriseHistoryYearInfoDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param enterpriseHistoryYearInfo 实例对象
     * @return 实例对象
     */
    @Override
    public EnterpriseHistoryYearInfo insert(EnterpriseHistoryYearInfo enterpriseHistoryYearInfo) {
        this.enterpriseHistoryYearInfoDao.insert(enterpriseHistoryYearInfo);
        return enterpriseHistoryYearInfo;
    }

    /**
     * 修改数据
     *
     * @param enterpriseHistoryYearInfo 实例对象
     * @return 实例对象
     */
    @Override
    public EnterpriseHistoryYearInfo update(EnterpriseHistoryYearInfo enterpriseHistoryYearInfo) {
        this.enterpriseHistoryYearInfoDao.update(enterpriseHistoryYearInfo);
        return this.queryById(enterpriseHistoryYearInfo.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String id) {
        return this.enterpriseHistoryYearInfoDao.deleteById(id) > 0;
    }
}